from PyPDF3 import PdfFileReader,PdfFileWriter
reader=PdfFileReader('test.pdf',strict=False)
if reader.isEncrypted:
    reader.decrypt(input('password: '))
writer=PdfFileWriter()
writer.appendPagesFromReader(reader)
f=open('out.pdf','wb')
writer.write(f)
f.close()
